package chapter06

import scala.beans.BeanProperty

/**
 * 类
 * 和对象
 */
object Test03_Class {
  def main(args: Array[String]): Unit = {
    val student = new Student
//    student.name  私有属性
    println(student.age)
    println(student.sex)

    student.sex="fam"
    println(student.sex)
  }
}

/**
 * 定义一个类
 * _代表空值
 *
 * @BeanProperty 代表get、set 符合javabean规范
 */
class Student {
  private var name: String = "alice"
  @BeanProperty
  var age: Int = _
  var sex: String = _


}
